const util = require('../../../../utils/util.js');
const api = require('../../../../config/api.js');
const user = require('../../../../services/user.js');
const common = require('../../../../utils/common.js');
const app = getApp()
Page({
  data: {
    circleid: '',
    //面板控制
    panelType: 0,
    //搜索栏输入
    searchText: '',
    //排序面板控制
    openPx: false,
    //排序类型控制
    pxType: null,
    //修改昵称面板控制
    showUpdateName: false,
    //修改的名字
    updateName: '',
    //淘汰面板控制
    showOutUser: false,
    //淘汰原因
    outUserText: '',
    //拒绝面板控制
    showDis: false,
  },
  onLoad: function (options) {
    var _this = this;
    var circleid = options.circleid;
    _this.setData({
      circleid: circleid
    })
    console.log(circleid)
  },
  onShow: function () {
    var _this = this
  },
  //拉伸顶部刷新
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh();
  },
  //拉伸底部加载
  onReachBottom: function () {
    wx.stopPullDownRefresh();
  },
  //选择浏览面板
  selectPanel: function (e) {
    var _this = this
    var index = e.currentTarget.dataset.index
    _this.setData({
      panelType: index
    })
  },
  //获取搜索框输入的文本
  inputText: function (e) {
    var _this = this
    var value = e.detail.value.replace(/\s+/g, '')
    _this.setData({
      searchText: value
    })
  },
  //打开排序面板
  showPX: function () {
    var _this = this
    _this.setData({
      openPx: true
    })
  },
  //选择排序类型
  selectPxType: function (e) {
    var _this = this
    var index = e.currentTarget.dataset.index
    var sel = _this.data.pxType
    if (index == 5) {
      _this.setData({
        pxType: null
      })
    } else {
      if (index == sel) {
        _this.setData({
          pxType: null
        })
      } else {
        _this.setData({
          pxType: index
        })
      }
    }
    _this.closeMC();
  },
  //打开修改昵称面板
  openUpdateName: function () {
    var _this = this
    _this.setData({
      showUpdateName: true
    })
  },
  //获取修改昵称输入的文字
  inputName: function (e) {
    var _this = this
    var value = e.detail.value.replace(/\s+/g, '')
    _this.setData({
      updateName: value,
    })
  },
  //打开淘汰提示面板
  openOutUser: function () {
    var _this = this
    _this.setData({
      showOutUser: true
    })
  },
  //获取淘汰原因输入的文字
  inputOutText: function (e) {
    var _this = this
    var value = e.detail.value.replace(/\s+/g, '')
    console.log(value)
    _this.setData({
      outUserText: value,
    })
  },
  //打开拒绝面板
  openDis: function () {
    var _this = this
    _this.setData({
      showDis: true
    })
  },
  //关闭面板
  closeMC: function () {
    var _this = this
    _this.setData({
      openPx: false,
      showUpdateName: false,
      showOutUser: false,
      showDis: false
    })
  },
  //进入成员权限管理
  gotoSetTitle: function(){
    var _this = this;
    var circleid = _this.data.circleid;
    wx.navigateTo({
      url: 'setTitle/setTitle?circleid=' + circleid
    })
  }
})